package com.eunion.web.character.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 性格测试题目实体类,目前专业评测 xqlx唯一设置
 * @author changzuzhe
 */
@Entity
@Table(name = "character_topic")
public class CharacterTopic implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3374479556245772124L;
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
	@Id
	private int id;
    @Column(name = "xqlx")
	private String xqlx;//测试题目类型
    @Column(name = "topic")
	private String topic;//题目内容
    @Column(name = "xzlx")
	private String xzlx;//单选or多选
    
    @OneToMany(mappedBy = "characterTopic",targetEntity = CharacterOption.class,
    		cascade={CascadeType.REMOVE,CascadeType.ALL,CascadeType.PERSIST},fetch = FetchType.EAGER)
    //@JoinColumn(name="id")
    private List<CharacterOption> mOpitons;
    
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	public String getXqlx() {
		return xqlx;
	}
	public void setXqlx(String xqlx) {
		this.xqlx = xqlx;
	}
	public String getTopic() {
		return topic;
	}
	public void setTopic(String topic) {
		this.topic = topic;
	}
	public String getXzlx() {
		return xzlx;
	}
	public void setXzlx(String xzlx) {
		this.xzlx = xzlx;
	}
	public List<CharacterOption> getmOpitons() {
		return mOpitons;
	}
	public void setmOpitons(List<CharacterOption> mOpitons) {
		this.mOpitons = mOpitons;
	}
	
	public String toString() {
		return "{" + "id:" + id +"\n"
				+ "topic:" + topic +"\n"
				+ "xzlx:" + xzlx +"\n"
				+ "xqlx:" + xqlx + "}";
	}
}
